
package br.com.cadastro.web.page;

import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.IHeaderContributor;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

import br.com.cadastro.entidade.Disciplina;
import br.com.cadastro.web.page.editar.EditaDisciplina;
import br.com.cadastro.web.page.home.ListaDisciplinas;


public class BasePage extends WebPage implements IHeaderContributor{



	private static final long serialVersionUID = 1L;

	@SuppressWarnings("rawtypes")
	public BasePage(){
		
		Link home = new Link("home"){
			private static final long serialVersionUID = 1L;
			@Override
			public void onClick() {
				setResponsePage(ListaDisciplinas.class);
			}
		};
		
		Link novo = new Link("novo"){
			private static final long serialVersionUID = 1L;
			@Override
			public void onClick() {
				setResponsePage(EditaDisciplina.class);
			}
		};
		
		add(home);
		add(novo);
	}

	public void renderHead(IHeaderResponse response)
	{
		response.renderCSSReference(new ResourceReference(BasePage.class,
		"estilo.css"));
		response.renderCSSReference(new ResourceReference(BasePage.class,
		"editaDisciplina.css"));
	}
}

class ActionPanel extends Panel
{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
     * @param id
     *            component id
     * @param model
     *            model for contact
     */
    @SuppressWarnings("unchecked")
	public ActionPanel(String id, IModel<Disciplina> model)
    {
        super(id, model);
        
        add(new Link("select")
        {
            Disciplina selected;
			private static final long serialVersionUID = 1L;

			@Override
            public void onClick()
            {
               selected = (Disciplina)getParent().getDefaultModelObject();
            }
        });
    }
}

